﻿@{
    ViewData["Title"] = "系统登录";
       Layout = "~/Views/Shared/_Layout.cshtml";
}<head>
    
   
   <link href="~/css/login.css" rel="stylesheet" />

  <style type="text/css">
      body {
      
          background-color:#2F4056;
      
      }
      

  </style>
   
    </head>



     <div class="login layui-anim layui-anim-up os">
         <div class="message">泰德在线管理中心（OA 云ERP MES）</div>
         <div id="darkbannerwrap"></div>

         <form method="post" class="layui-form">
             <input name="username" placeholder="用户名 &#xe770" type="text" lay-verify="required" class="layui-input layui-icon">
             <hr class="hr15">
             <input name="password" lay-verify="required" placeholder="密码" type="password" class="layui-input">
             <hr class="hr15">
             <input value="登录" lay-submit lay-filter="login" class="layui-btn layui-btn-radius layui-btn-warm" style="width:100%;" type="submit">
             <hr class="hr20">
         </form>
     </div>

     <script>
         $(function () {
             layui.use('form', function () {
                 var form = layui.form;
                 // layer.msg('玩命卖萌中', function(){
                 //   //关闭后的操作
                 //   });
                 //监听提交
                 form.on('submit(login)', function (data) {
                     // alert(888)
                     //layer.msg(JSON.stringify(data.field), function () {
                     //    location.href = 'index.html'
                     //});
                     $.ajax({
                     type: "POST",
                     url: '/Main/Login',
                        data: data.field,
                         dataType: "json",
                         success: function (data) {
                            
                           
                             if (data.msg == "ok") {
                                // alert('登录成功');
                                  layer.msg('登录成功', { icon: 5, time: 2000 });
                                 location.href = "/main/index/" ;
                                  
                             } else {
                    
                                  layer.msg(data.msg, { icon: 5, time: 2000 });
                             }
                         }
                         , error: function () {
                              layer.msg("登陆请求失败，请再次尝试，或者检查网络", { icon: 5, time: 2000 });
                       // alert("登陆请求失败，请再次尝试，或者检查网络");
                    }


                     });

                     return false;//重点  不然会提交2次表单
                 });
             });
         })
     </script>
     <!-- 底部结束 -->

